import { LoaderHelp } from "../../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../../resource/ResFileConst";
import { TRuneManual } from "../../../../../../Message/Db/Tables/TRuneManual";
import { RuneSwallowConfig } from "../../../../resource/RuneSwallowConfig";
import { SkillRuneHandbookRuneItem } from "./SkillRuneHandbookRuneItem";
import { RuneUtil } from "../RuneUtil";
import { ItemData } from "../../../../resource/info/ItemData";
import { ObjCreate } from "../../../common/ObjCreate";
import { GlobalClass } from "../../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { GTextFiled } from "../../../../../../com/mui/controls/GTextFiled";
//class SkillRuneHandbookHolyItem
    
    export  class SkillRuneHandbookHolyItem /* flash.display.Sprite */
    {
        constructor()
        {
            
            LoaderHelp.addResCallBack(ResFileConst.rune, this.initView);
            return;
        }

        public update(arg1: TRuneManual): void
        {
            var loc5=0;
            var loc6=null;
            var loc1=arg1.levelOne;
            var loc2=RuneSwallowConfig.instance.getHolyRuneCanSwllowCodes(loc1);
            this._mainItem.update(loc1);
            var loc3=0;
            while (loc3 < this._items.length) 
            {
                loc5 = int(loc2[loc3]);
                (loc6 = this._items[loc3] as SkillRuneHandbookRuneItem).update(loc5);
                if (loc3 < loc2.length) 
                {
                    loc6.toolTipData = RuneUtil.getRunesHandbookDesc(loc5);
                }
                ++loc3;
            }
            var loc4=new ItemData(loc1);
            this._txtName.htmlText = loc4.htmlName;
            this._txtDesc.text = arg1.desc;
            return;
        }

        /* internal  */initView(): void
        {
            var loc3=0;
            var loc4=null;
            ObjCreate.createBg(0, 0, 495, 128, this);
            this._txtName = ObjCreate.createGTextField("", 9, 16, 200, 20, this);
            var loc1=GlobalClass.getBitmap(ImagesConst.TileBg);
            loc1.x = 125;
            loc1.y = 11;
            this.addChild(loc1);
            this._txtDesc = ObjCreate.createGTextField("", 103, 15, 240, 20, this);
            var loc2=this._txtDesc.defaultTextFormat;
            loc2.align = flash.text.TextFormatAlign.CENTER;
            this._txtDesc.defaultTextFormat = loc2;
            this._txtDesc.textColor = 1179426;
            this._mainItem = new SkillRuneHandbookRuneItem();
            this._mainItem.x = 10;
            this._mainItem.y = 48;
            this.addChild(this._mainItem);
            loc1 = GlobalClass.getBitmap(ImagesConst.SkillRuneInclude);
            loc1.x = 78;
            loc1.y = 54;
            this.addChild(loc1);
            this._items = [];
            loc3 = 0;
            while (loc3 < 5) 
            {
                (loc4 = new SkillRuneHandbookRuneItem()).y = 48;
                loc4.x = 128 + loc3 * 73;
                this.addChild(loc4);
                this._items.push(loc4);
                ++loc3;
            }
            return;
        }

        /* internal */ /* var */_txtName: GTextFiled;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_mainItem: SkillRuneHandbookRuneItem;

        /* internal */ /* var */_items: Array<any>;
    }
